<?php
header('content-type:text/html;charset=utf-8');
try {
	$pdo=new PDO('mysql:host=localhost; dbname=exercise','root','root');
	/*$sql = <<<EOF
		INSERT INTO user(username,password,email) VALUES ("Tom4","Tom4","Tom@qq.com"),
		("Tom2","Tom2","Tom@qq.com"),
		("Tom3","Tom3","Tom@qq.com")
EOF;*/
	$sql = 'INSERT INTO user(username, password, email) VALUES ("Tom6","Tom6","Tom@qq.com")';
	$res = $pdo->exec($sql);
	echo "受影响的记录的条数为：".$res."<br>";
	//$pdo->lastInsertId();
	echo "插入数据库中的ID号为：".$pdo->lastInsertId();
} catch(PDOException $e) {
	echo $e->getMessage();
}
?>